package com.googlecode.phpunit4eclipse.j2phpunit.parser;

import java.util.HashMap;

/**
 * @author Bertrand Paquet
 */
public class PHPMap extends HashMap<String, Object> {

	private static final long serialVersionUID = 8334901220519206382L;
	
	public static final String PROTECTED_PREFIX = "\u0000*\u0000";

	@Override
	public Object get(Object key) {
		Object o = super.get(key);
		if (o != null) {
			return o;
		}
		return super.get(PROTECTED_PREFIX + key);
	}
	
	public String getString(String key) {
		return (String) get(key);
	}
	
	public Integer getInteger(String key) {
		return (Integer) get(key);
	}

	public static PHPMap cast(Object phpElement) {
		return (PHPMap) phpElement;
	}

}
